#include <iostream>

#include "InetAddr.hpp"
#include "UdpServer.hpp"
#include "MessageRouter.hpp"

void useage(char* argv[])
{
    std::cout << "useage:" << std::endl;
    std::cout << "\t" << argv[0] << " + port" << std::endl;
}

int main(int argc, char* argv[], char* env[])
{
    if (argc != 2)
    {
        useage(argv);
        return 0;
    }
    
    uint16_t port = std::stoi(argv[1]);

    MessageRouter msgRouter;
    auto func = std::bind(&MessageRouter::router, &msgRouter, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
    UdpServer udpSvr(port, func);

    udpSvr.start();

    return 0;
}   